import Http from '@/http';
import { dictionaryItemByCategoryApi } from './system/Dictionary';

export function saveApi(params:any) {
    return params.id ? Http.put('app/update/' + params.id, params) : Http.post('app/add', params)
}

export function pageApi(params:any) {
    return Http.post('app/page', params)
}

export function deleteApi(id) {
    return Http.delete('app/delete/' + id)
}



export function appTypeApi() {
    return dictionaryItemByCategoryApi('APP_TYPE')
}

export function linkTypepeApi() {
    return dictionaryItemByCategoryApi('LINK_TYPE')
}


export function uploadApi(file:File) {
    const formData = new FormData()
    formData.append('pic', file)
    return Http.post('app/upload', formData)
}


export function importAppsApi(file:File, category) {
    const formData = new FormData()
    formData.append('file', file)
    return Http.post('app/import/' + category, formData)
}

export function importtaskappApi(file:File) {
    const formData = new FormData()
    formData.append('file', file)
    return Http.post('app/importtaskapp', formData)
}


